// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
    imgs: [],
    searchArr: []
  },


  // 事件处理函数
  bindViewTap() {

  },
  onLoad() {
    wx.request({
      url: 'http://192.168.124.107:8080/banner/index/bannerList',
      success: res=> {
        this.setData({
          imgs: res.data.data
        })
      }
    })
  },
  // search
  change(e){
    this.setData({
      flag: true
    })
    if(e.detail.value){
      wx.request({
        url: 'http://192.168.124.104:8080//search/searchKey?key=' + e.detail.value,
        success: res => {
          this.data.searchArr = res.data.data.map(item => {
            return item.split("=")[1].replace("SNUM", "")
          })
          this.setData({
            searchArr: this.data.searchArr
          })
        }
      })
    } else {
      this.setData({
        searchArr: []
      })
    }
  },

  

})
